package com.syn.michat.service.impl;

import com.syn.michat.constant.ErrorContants;
import com.syn.michat.constant.FriendContants;
import com.syn.michat.mapper.ScreenshotsReportMapper;
import com.syn.michat.pojo.ScreenshotsReport;
import com.syn.michat.service.ScreenshotsReportService;
import com.syn.michat.util.exception.ClientException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ScreenshotsReportServiceImpl implements ScreenshotsReportService {

    @Autowired
    private ScreenshotsReportMapper screenshotsReportMapper;

    @Override
    public void save(ScreenshotsReport report) throws ClientException {
        try {
            screenshotsReportMapper.save(report);
        } catch (Exception e) {
            throw new ClientException(ErrorContants.SQL_INCORRECT, e.getMessage());
        }
    }

    @Override
    public List<ScreenshotsReport> list(String targetId, String userId) throws ClientException {
        try {
            return screenshotsReportMapper.queryAllReport(targetId, userId);
        } catch (Exception e) {
            throw new ClientException(ErrorContants.SQL_INCORRECT, e.getMessage());
        }
    }
}
